package com.prs.crm.action.oa;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.courser.struts.BaseAction;
import org.courser.ui.PaginationSupport;
import org.hibernate.criterion.DetachedCriteria;

import com.prs.crm.domain.oa.CustomButtonSet;
import com.prs.crm.service.oa.CustomButtonSetService;

/**
 * @author YangHao
 * @E-Mail:450098606@qq.com
 * @qq:450098606
 * @version 创建时间：2012-5-10 17:16:42 自定义按纽设置
 */
public class CustomButtonSetAction extends BaseAction{

	private static final long serialVersionUID = 1L;
	
	private CustomButtonSet customButtonSet;
	private CustomButtonSetService customButtonSetService;
	private PaginationSupport pagination;
	private Integer[] ids;
	public CustomButtonSet getCustomButtonSet() {
		return customButtonSet;
	}
	public void setCustomButtonSet(CustomButtonSet customButtonSet) {
		this.customButtonSet = customButtonSet;
	}
	public CustomButtonSetService getCustomButtonSetService() {
		return customButtonSetService;
	}
	public void setCustomButtonSetService(
			CustomButtonSetService customButtonSetService) {
		this.customButtonSetService = customButtonSetService;
	}
	public PaginationSupport getPagination() {
		return pagination;
	}
	public void setPagination(PaginationSupport pagination) {
		this.pagination = pagination;
	}
	public Integer[] getIds() {
		return ids;
	}
	public void setIds(Integer[] ids) {
		this.ids = ids;
	}
	
	@Action("listCustomButtonSet")
	public String listCustomButtonSet(){
		DetachedCriteria criteria=this.getPaginationHelper().createQuery(CustomButtonSet.class);
		pagination=this.getPaginationHelper().prepare(pagination);
		this.setPagination(this.getCustomButtonSetService().listByPage(criteria, pagination));
		return SUCCESS;
	} 
	
	@Action("editCustomButtonSet")
	public String editCustomButtonSet(){
		return SUCCESS;
	}
	
	@Action(value="saveCustomButtonSet",results={
			@Result(name="success",type="redirect",location="editCustomButtonSet"),
			@Result(name="error",type="chain",location="editCustomButtonSet")
	})
	public String saveCustomButtonSet(){
		this.getCustomButtonSetService().save(customButtonSet);
		return SUCCESS;
	}
	
	@Action(value="removeCustomButtonSet",results={
			@Result(name="success",type="redirect",location="editFramesSet"),
			@Result(name="error",type="chain",location="editFramesSet")
	})
	public String removeCustomButtonSet(){
		this.getCustomButtonSetService().batchRemove(ids);
		return SUCCESS;
	}
}
